<?php
	require "../modules/conn.php";
	$uname=$_REQUEST["uname"];
	$upassword=$_REQUEST["upassword"];
	$ugender=$_REQUEST["ugender"];
	$uphone=$_REQUEST["uphone"];
	// echo $ugender;
	$sql1="select * from t_user where uphone=$uphone";
	$result1=mysqli_query($conn,$sql1);

	$sql2="insert into t_user(uname,upassword,ugender,uphone) values('$uname',$upassword,'$ugender','$uphone')";
	if(!mysqli_num_rows($result1)){
		$result2=mysqli_query($conn,$sql2);
		if($result2){
				echo "<script>
						alert('regist success');
						location='../login_regist.html';
					</script>";
		}else{
			echo "error";
		}
	}else{
		echo "<script>
				alert('this user already regist,please login');
				location='../login_regist.html';
			</script>";
	}
	
	// echo $sql;
?>